﻿using System.Collections.Generic;
using System.Web.Mvc;
using ZBJF.Warranty.Common.Common;
using ZBJF.Warranty.Common.Enums.System;

namespace ZBJF.Warranty.AdminSite.Areas.System.Controllers
{
    public class SettingsController : Controller
    {
        public ActionResult Index()
        {
            return View();
        }

        [HttpPost]
        public ActionResult RefreshCache()
        {
            CacheHelper.Instance.RemoveAllCache();
            var webApiCaller = new WebApiCaller();
            try
            {
                webApiCaller.Get("http://tservice.zhongbaojinfu.com.cn/common/RemoveAllCache", new Dictionary<string, string>());
                webApiCaller.Get("http://service.zhongbaojinfu.com.cn/common/RemoveAllCache", new Dictionary<string, string>());
                webApiCaller.Get("http://admin.zhongbaojinfu.com.cn/common/RemoveAllCache", new Dictionary<string, string>());
                webApiCaller.Get("http://tadmin.zhongbaojinfu.com.cn/common/RemoveAllCache", new Dictionary<string, string>());
            }
            catch
            {
            }
            var responseResult = new ResponseResult
            {
                Success = true,
                Message = "清空缓存成功！"
            };
            TempData["ResponseResult"] = responseResult;
            return View("Index");
        }
    }
}